<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">
    <title>默认点标记</title>
    <link rel="stylesheet" href="https://a.amap.com/jsapi_demos/static/demo-center/css/demo-center.css"/>
    <style>
        html, body, #container {
            height: 100%;
            width: 100%;
        }

        .amap-icon img,
        .amap-marker-content img{
            width: 25px;
            height: 34px;
        }

        .marker {
            position: absolute;
            top: -20px;
            right: -118px;
            color: #fff;
            padding: 4px 10px;
            box-shadow: 1px 1px 1px rgba(10, 10, 10, .2);
            white-space: nowrap;
            font-size: 12px;
            font-family: "";
            background-color: #25A5F7;
            border-radius: 3px;
        }

        .input-card{
            width: 18rem;
            z-index: 170;
        }

        .input-card .btn{
            margin-right: .8rem;
        }

        .input-card .btn:last-child{
            margin-right: 0;
        }
    </style>
</head>
<body>
<div id="container"></div>
<div class="input-card">
   
</div>
<script type="text/javascript"
        src="https://webapi.amap.com/maps?v=1.4.15&key=0a293e2b71806dc12cc1b96a28b3985c"></script>
<script type="text/javascript">
    var marker, map = new AMap.Map("container", {
        resizeEnable: true,
        center: [116.397428, 39.90923],
        zoom: 5
    });

    // 实例化点标记
   
    let a1 = 117.328911;
    let b1 = 40.937229;

    let a3 = 117.928911;
    let b3 = 42.937229;



    var path = [];
    path.push([111.303843, 39.983412]);
    path.push([a1, b1]);
    path.push([119.407012, 39.992093]);
    map.plugin("AMap.DragRoute", function() {
        route = new AMap.DragRoute(map, path, AMap.DrivingPolicy.LEAST_FEE); //构造拖拽导航类
        route.search(); //查询导航路径并开启拖拽导航
    });

    marker.setMap(map);

    marker = new AMap.Marker({
        icon: "../img/zuobiao.svg",
        position: [a3, b3],
    });
    marker.setMap(map);

    var path = [//每个弧线段有两种描述方式
        [a1, b1],//起点
       
        //第四段弧线
        [a3, b3]
        //控制点，控制点，途经点，每段最多两个控制点
    ];


   
    //构建信息窗体中显示的内容
    var info = [];
    info.push("<div class='input-card content-window-card'><div><img style=\"float:left;\" src=\" https://webapi.amap.com/images/autonavi.png \"/></div> ");
    info.push("<div style=\"padding:7px 0px 0px 0px;\"><h4>高德软件</h4>");
    info.push("<p class='input-item'>电话 : 010-84107000   邮编 : 100102</p>");
    info.push("<p class='input-item'>地址 :北京市朝阳区望京阜荣街10号首开广场4层</p></div></div>");

    infoWindow = new AMap.InfoWindow({
        content: info.join("")  //使用默认信息窗体框样式，显示信息内容
    });

    infoWindow.open(map, map.getCenter());
    


    var path = [
    new AMap.LngLat(a1,b1),
    // new AMap.LngLat(116.382122,39.901176),
    // new AMap.LngLat(116.387271,39.912501),
    new AMap.LngLat(a3,b3)
];

// 创建折线实例
var polyline = new AMap.Polyline({
    path: path,  
    borderWeight: 2, // 线条宽度，默认为 1
    strokeColor: 'orange', // 线条颜色
    lineJoin: 'round' // 折线拐点连接处样式
});

map.add(polyline);

   
    
   
</script>
</body>
</html>